import fetch from 'common/src/utils/fetch'

const api = {
  // 提交开题报告 查询列表
  getSubmitList(data) {
    return fetch({
      url: '/api/designservice/openReport/list',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查课题名称信息
  getSubjectDetail(data) {
    return fetch({
      url: '/api/designservice/common/project',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查学生信息
  getStudentInfo(data) {
    return fetch({
      url: '/api/designservice/common/studentInfo',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 保存开题报告
  save(data) {
    return fetch({
      url: '/api/designservice/openReport/add',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 编辑开题报告
  update(data) {
    return fetch({
      url: '/api/designservice/openReport/edit',
      method: 'put',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 提交开题报告
  submit(data) {
    return fetch({
      url: '/api/designservice/openReport/createFlow',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 审核通过(驳回) 撤销，指定审核人提交
  approval(data) {
    return fetch({
      url: '/api/designservice/openReport/approval',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查看开题报告详情
  getReportDetail(id) {
    return fetch({
      url: `/api/designservice/openReport/detail?id=${id}`,
      method: 'get',
      headers: {
        'Content-Type': 'application/json'
      }
    })
  },
  // 删除开题报告
  delete(data) {
    return fetch({
      url: '/api/designservice/openReport/delete',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 审核开题报告(教务员) 指定审核人 提交
  designated(data) {
    return fetch({
      url: '/api/designservice/openReport/changeApproval',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 审核开题报告(导师) 查列表
  getTutorList(data) {
    return fetch({
      url: '/api/designservice/openReport/getTutorTask',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 审核开题报告(教务员) 查列表
  getAcademicList(data) {
    return fetch({
      url: '/api/designservice/openReport/getAdminTask',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 审核开题报告(指定人) 查列表
  getAppointList(data) {
    return fetch({
      url: '/api/designservice/openReport/getSpecialTask',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 判断学生文理科
  getStuArtsOrSciences(data) {
    return fetch({
      url: '/api/designservice/common/subjectCategory',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 导出
  export(data) {
    return fetch({
      url: '/api/designservice/openReport/export',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查导出状态
  getFileExportStatus(key) {
    return fetch({
      url: `/api/designservice/common/asyncProcessResult/${key}`,
      method: 'get',
      showMask: false
    })
  },
  // 查学院
  getCollege() {
    let authId = localStorage.getItem('activeAuthId')
    return fetch({
      url: `/api/designservice/common/college?authId=${authId}`,
      method: 'get',
      headers: {
        'Content-Type': 'application/json'
      }
    })
  },
  // 根据毕业年份和学院查专业
  getSubject(data) {
    return fetch({
      url: '/api/designservice/common/findSubject',
      method: 'post',
      headers: {
        'Content-Type': 'application/json'
      },
      data
    })
  },
  // 查审核进度
  getProgress(applyNo) {
    return fetch({
      url: `/api/workflow/approval/selectApproFlow?no=${applyNo}`,
      method: 'get',
      headers: {
        'Content-Type': 'application/json'
      }
    })
  }
}

export default api
